#include "StdAfx.h"
#include "CProTimer.h"

CProTimer::CProTimer()
{
	QueryPerformanceFrequency((LARGE_INTEGER *) &m_CounterFrequency);
	Reset();
}

void CProTimer::Reset()
{
	QueryPerformanceCounter((LARGE_INTEGER *) &m_ResetTime);
}

float CProTimer::GetTime(bool reset)
{
	LONGLONG currentTime;
	QueryPerformanceCounter((LARGE_INTEGER *) &currentTime);

	LONGLONG diffTime = currentTime - m_ResetTime;

   if (reset)
      m_ResetTime = currentTime;

	return (float) (1000*diffTime) / (float) m_CounterFrequency;
}
